package org.linlinjava.litemall.db.service;

import org.linlinjava.litemall.db.dao.TUserMapper;
import org.linlinjava.litemall.db.domain.LitemallBrand;
import org.linlinjava.litemall.db.domain.LitemallCustomer;
import org.linlinjava.litemall.db.domain.LitemallService;
import org.linlinjava.litemall.db.domain.TUser;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class TUserService {
    @Resource
    TUserMapper dao;

    public void insert(TUser user) {
        dao.insertSelective(user);
    }

    public void insert(LitemallService user) {
        TUser temp = new TUser();
        temp.setUserName(user.getUsername());
        dao.insertSelective(temp);
        user.setImId(temp.getId());
    }

    public void insert(LitemallCustomer user) {
        TUser temp = new TUser();
        temp.setUserName(user.getUsername());
        dao.insertSelective(temp);
        user.setImId(temp.getId());
    }

    public void update(TUser tUser) {
        dao.updateByPrimaryKeySelective(tUser);
    }
}
